package com.muse.app.controller;

import com.muse.app.service.FileService;
import com.muse.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: lee
 * Date: 2021/4/19
 * Time: 8:39 下午
 * Description:
 */
@RestController
@RequestMapping(value = "/file")
public class FileController {

    @Autowired
    public FileService fileService;


    @PostMapping("/upload")
    public Result<Map<String, String>> upload(@RequestParam MultipartFile file, HttpServletRequest request) {
        return fileService.upload(file, request);
    }
}
